package com.sjj.myuser.mapper;

import com.sjj.myuser.QQ;
import org.apache.ibatis.annotations.*;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.stereotype.Component;
import pojo.User;

import java.util.List;

/**
 * className:UserMapper
 * Package:com.sjj.myuser.mapper
 * Description:
 *
 * @Date: 2022/8/7 0:13
 * @Auther: wssky19890629@163.com
 */

@Mapper
@Component
public interface UserMapper  {
    @Select("select * from user  where username = #{username} ")
    User getUserByUsername(String username);

    @Insert("insert into user(username,password,role,nickname,idcard) values(#{username},#{password},#{role},#{nickname},#{idCard}) ")
    int insertUser(User user);

    @Update("update user set nickname=#{nickname} where Userid=#{userId}")
    int updateNickname(User user);

    @Select("select * from user where nickname=#{nickname} ")
    User selectUserByNickname(String nickname);

    @Insert("insert into qq(status) values(#{status})")
    int insertTest(String status);

    @Select(("select * from qq where status=1 limit 1000"))
    List<QQ> selectall();

    @Update("update qq set status=2 where id=#{id}")
    int updateStatus(QQ qq);
}
